<%--
  Created by IntelliJ IDEA.
  User: haibo.wang
  Date: 13-7-9
  Time: 下午3:44
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>首页</title>
</head>
<body>
    <div>
        <h1>订阅列表</h1>
        <a href="${pageContext.request.contextPath}/url/add">添加</a>
    </div>
    <table border="1">
        <tr>
            <th >名称</th>
            <th>URL</th>
            <th>操作</th>
            <th>保存位置</th>
        </tr>
        <c:choose>
            <c:when test="${not empty urls}">
                <c:forEach items="${urls}" var="url">
                    <tr>
                        <td>${url.name}</td>
                        <td>${url.url}</td>
                        <td>${url.location}</td>
                        <td>
                            <a href="${pageContext.request.contextPath}/url/view/${url.id}">查看</a>
                            <a href="${pageContext.request.contextPath}/url/edit/${url.id}">编辑</a>
                            <a href="${pageContext.request.contextPath}/url/delete/${url.id}">删除</a>
                        </td>
                    </tr>
                </c:forEach>
            </c:when>
            <c:otherwise>
                <tr><td colspan="3">没有结果。</td></tr>
            </c:otherwise>
        </c:choose>
    </table>
    <br/>
    <div>
        <h1>添加订阅</h1>
    </div>
    <div>
        <form action="${pageContext.request.contextPath}/url/setup" id="addUrlForm" method="post">
            <p><label>名称</label><input type="text" name="name"/></p>
            <p><label>url</label><input type="text" name="url"/></p>
            <p><input type="submit" value="保存"></p>
        </form>
    </div>
</body>
</html>